< previous page page_128 next page >

Page 128
3. What's wrong with variants as return types?
4. What's a good way to help manage memory use?
5. What are the best ways to achieve reuse?
6. What is an implementation class?
7. What should you do when you discover design flaws in construction?
8. What is aggregation?
9. What responsibility does a composite object have?
10. Briefly explain containment.
Exercises
1. Open a new Standard Visual Basic project. Use the Class Builder utility to create the following interface class:
9f8044bafea36a1f728739c0bb58ef4c.gif
Class:
ITelevision

Methods:
Public Function turnOn()
Public Function turnOff()
Public Function incrementChannel()
Public Function decrementChannel()
Public Function displayMenu()
9f8044bafea36a1f728739c0bb58ef4c.gif
Attributes:
9f8044bafea36a1f728739c0bb58ef4c.gif
CurrentChannel As String
BrandName As String
ModelName As String
9f8044bafea36a1f728739c0bb58ef4c.gif
Now create a class that implements ITelevision.
2. Using exercise 1, try to discover new methods and properties to add to the interface. How would those changes affect the other class that already implemented that interface?
3. Review the code in Listing 5.1. List some ways you would improve the public methods and properties of the classes.
4. Review the following class:
9f8044bafea36a1f728739c0bb58ef4c.gif
Class:
9f8044bafea36a1f728739c0bb58ef4c.gif
Savings
9f8044bafea36a1f728739c0bb58ef4c.gif
Attributes:
9f8044bafea36a1f728739c0bb58ef4c.gif
AccountNumber
CurrentBalance
InterestRate

 
< previous page page_128 next page >

If you like this book, buy it!